﻿    /**
     * 发送添加患者消息
     */
    fun sendAddPatientMessage(
        name: String,
        gender: String,
        age: Int?,
        phone: String?,
        idCard: String?,
        examinationDate: String,
        diagnosis: String?,
        notes: String?,
        examinationName: String?,
        admissionDate: String?
    ) {
        if (isConnected.get()) {
            val addPatientMessage = RealtimeMessage(
                type = MessageType.ADD_PATIENT,
                data = AddPatientData(
                    name = name,
                    gender = gender,
                    age = age,
                    phone = phone,
                    idCard = idCard,
                    examinationDate = examinationDate,
                    diagnosis = diagnosis,
                    notes = notes,
                    examinationName = examinationName,
                    admissionDate = admissionDate,
                    timestamp = System.currentTimeMillis()
                )
            )
            sendMessage(addPatientMessage)
            Log.d(TAG, "患者信息发送成功: ")
        } else {
            Log.w(TAG, "WebSocket未连接，无法发送患者信息")
        }
    }
